//
//  NSNumber+NSNumberExtend.m
//  
//
//  Created by wjxfhxy on 16/3/23.
//
//

#import "NSNumberExtend.h"

@implementation NSNumber (Decimal)

-(NSString*)roundBankersStringValue
{
    return [self roundBankersStringValue:2];
}

-(NSString*)roundBankersStringValue:(NSUInteger)pointScale
{
    NSDecimalNumberHandler *handler = [NSDecimalNumberHandler decimalNumberHandlerWithRoundingMode:NSRoundPlain scale:pointScale raiseOnExactness:NO raiseOnOverflow:NO raiseOnUnderflow:NO raiseOnDivideByZero:NO];
    NSDecimalNumber *d = [NSDecimalNumber decimalNumberWithString:[self stringValue]];
    d = [d decimalNumberByRoundingAccordingToBehavior:handler];
    return [NSString stringWithFormat:@"%@",d];
}

@end
